package tests;

import core.BlogException;
import core.Clanek;
import java.util.logging.Level;
import java.util.logging.Logger;
import model.ClanekModel;

/**
 *
 * @author mini
 */
public class testClanek {
           
  public static void main(String[] args) {
        try {
             ClanekModel model= new ClanekModel();                    
            Clanek c = new Clanek();
            c.setId(9999);
            c.setKategorie(1);
            c.setNazev("Testovaci");
            c.setLibi(10);
            c.setNelibi(666);
            c.setText("Nejctenejsi clanek o testovani,testovcacim softwate a loren ipsum ze jo");
            c.setNavstevnost(676);
            
            
            model.addClanek(c);
            System.out.println("Clanek byl pridan");
            Clanek d=new Clanek();
            d.setId(1);
            c=model.getClanek(d);
            if(c!=null)System.out.println("clanek nacten");
            System.out.println("ID "+ c.getId()+" kategorie "+ c.getKategorie()+" Nazev: "+ c.getNazev() +" Navstevnost: "+c.getNavstevnost()+" Libi: "+c.getLibi()+" Nelibi: "+c.getNelibi()+ "delka: "+ c.getDelka() +" Text: "+c.getText());
           
            c.setNelibi(20);
            model.editClanek(c);
            d=model.getClanek(c);
            System.out.println("Po editaci ma nelibi: "+d.getNelibi());
            model.removeClanek(c);
            System.out.println("Smazano");
            System.out.println("Uzivatel smazan");
        } catch (BlogException ex) {
            Logger.getLogger(testClanek.class.getName()).log(Level.SEVERE, null, ex);
        }
        
                       
        
    }
}
